package com.sodaopen.study.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.sodaopen.study.entity.User;


public interface UserMapper {

    @Select("select * from t_user")
    List<User> findAllUser();

    @Select("select * from t_user where username = #{username}")
	User selectByUsername(String username);

    @Update("update t_user set name=#{name}, phone=#{phone}, qq=#{qq}, email=#{email} where id=#{id}")
	void updateProfiles(User user);

    @Update("update t_user set password=#{password} where id=#{id}")
	void updatePassword(User user);

    @Update("update t_user set pic=#{pic} where id=#{id}")
	void updatePic(User user);

    @Insert("insert into t_user (username, password, name, phone) values (#{username}, #{password}, #{name}, #{phone})")
	void insertUser(User user);

    @Select("select * from t_user order by id desc")
	List<User> selectByParam();

    @Update("update t_user set clazz_id=#{clazzId} where id=#{userId}")
	void updateUserClazz(@Param("userId") Integer userId, @Param("clazzId")Integer clazzId);
}
